﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 实验三._2
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, string> dicl = new Dictionary<string, string>();
            dicl.Add("爱", "love");
            dicl.Add("食物", "food");
            dicl.Add("床", "bed");
            dicl.Add("书", "book");
            Console.WriteLine("输入要查询的单词：");
            string s = Console.ReadLine();
            if (dicl.ContainsKey(s))
                Console.WriteLine("查找“{0}”单词为：{1}", s, dicl[s]);
            else Console.WriteLine("单词未收入！");
            Dictionary<int, Tuple<string, string>> dic2 = new Dictionary<int, Tuple<string, string>>();
            dic2.Add(1, new Tuple<string, string>("运城", "太原"));
            dic2.Add(2, new Tuple<string, string>("九江", "西安"));
            dic2.Add(3, new Tuple<string, string>("西安", "运城"));
            Console.WriteLine("输入要查询的车次：");
            s = Console.ReadLine();
            int number;
            int.TryParse(s, out number);
            if (dic2.ContainsKey(number))
                Console.WriteLine("查找车次{0}的站点为：{1}", s, dic2[number]);
            else Console.WriteLine("无该车次！");
            Console.WriteLine("/***********循环遍历************/");
            foreach (string key1 in dicl.Keys)
                Console.WriteLine("中文：{0}    英文：{1}", key1, dicl[key1]);
            foreach (int key2 in dic2.Keys)
                Console.WriteLine("车次：{0}    站点：{1}", key2, dic2[key2]);
            Console.ReadKey();
        }
    }

}
